﻿using Kinlo.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Comm.CommHelper
{
    public static class CommHelper
    {
        public static List<AfterWeightFirst2> ToAfterWeightFirst2(this ObservableCollection<AfterWeightFirst> datas )
        {
            try
            {               
                var result = new List<AfterWeightFirst2>();
                if (datas != null && datas.Count > 0)
                {
                    foreach(var data in datas)
                    {
                        var w = new AfterWeightFirst2();
                        w.BeforWeight_One = data.BeforWeight_One;
                        w.AfterWeight_One = data.AfterWeight_One;
                        w.InjectionNum_One = data.InjectionNum_One;
                        w.Result_One = data.Result_One;
                        w.Code = data.Code;
                        w.ProductDate = data.ProductDate;
                        result.Add(w);
                    } 
                }
                return result;

            }catch(Exception ex)
            {
                Logger.Log(string.Format("{0} {1} {2}", "Helper", "ToAfterWeightFirst2", ex.Message));
                return null;
            }

        }
    }
}
